/*
 * @Description: 虫情设备管理
 */
import zhreq from "@/utils/request";
export default {
  /**
   * @description: 查询所有虫情设备 *代表必填
   * @param {String/Number} page
   * @param {String/Number} size
   */
  getAllList(params) {
    return zhreq.get(`v3/insectSituation/insectDeviceManagement/queryByCompanyMark?companyMark=${params}`, {
      // params: {
      //   "companyMark": sessionStorage.getItem("organizationNo")
      // }
    });
  },

  /**
   * @description: 获取所拥有虫情设备列表 *代表必填
   * @param {Object}  *
   */
  getownlist(params) {
    let jk = {
      "farmingTypeNo": sessionStorage.getItem("farmingTypeNo")
    }
    // 只能上层来看，种植户自己不能看
    // if (sessionStorage.getItem("parentId")) {
    jk.organizationNo = sessionStorage.getItem("organizationNo")
    // }
    return zhreq.post('v3/insectSituation/insectDevice/queryPageList', {
      ...params,
      ...jk
    })
  },
  /**
   * @description: 批量添加虫情设备
   * @param {Object}  *
   */
  addlist(params) {
    return zhreq.post('v3/insectSituation/insectDevice/add',
      {
        ...params,
        latitude: params.llatitude,
        farmingTypeNo: sessionStorage.getItem("farmingTypeNo"),
        organizationNo: sessionStorage.getItem("organizationNo")
      }

    );
    // return zhreq.post('/base/farmingType/add', params);
  },
  /**
   * @description: 批量删除虫情设备
   * @param {Object}  *
   */
  dellist(params) {
    return zhreq.post('v3/insectSituation/insectDevice/delList', {
      'insectDeviceIdList': params
    });
  }, /**
  * @description: 批量删除虫情设备
  * @param {Object}  *
  */
  del(params) {
    return zhreq.get(`v3/insectSituation/insectDevice/del?insectDeviceId=${params}`);
  },
  /**
   * @description: 修改虫情设备
   * @param {Object}  *
   */
  editlist() {
    return zhreq.post('v3/insectSituation/insectDevice/edit', {
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 配置虫情设备信息
   * @param {Object}  *
   */
  editConfig(params) {
    return zhreq.post('v3/insectSituation/pestrisklevelconfiguration/edit', params);
  },
  /**
   * @description: 查询虫情设备配置
   * @param {Object}  *
   */
  queryByInsectDeviceId(id) {
    return zhreq.get(`v3/insectSituation/pestrisklevelconfiguration/queryByInsectDeviceId?insectDeviceId=${id}`);
  },
  /**
   * @description: 查询虫害
   * @param {Object}  *
   */
  pestQueryList() {
    return zhreq.get(`v3/insectSituation/pestrisklevelconfiguration/pestQueryList`);
  },
};
